import * as at from '../constant';
//分离action动作，并暴露
export const increAction = (val)=>{
  return { type: at.INCRE, num: val * 1 }
}

export const decreAction = ()=>{
  return { type: at.DECRE, num: 1 }
}
//异步操作时在action里操作，返回一个回调函数，同时传递dispatch，
//异步操作也是调用同步操作方法，直接在action里调用，不经过reduer
export const increAsyncAction = (val,time)=>{
  return (dispatch)=>{
    setTimeout(() => {
      dispatch(increAction(val))
    }, time);
  }
}
